<?php

use \core\ViewLoader\ViewLoader;
use \core\Db\Db;
use \core\Controller\Controller;
use \pub\models\user;

class mainpage extends Controller{
    //public $needAuth = TRUE; // tell this controller that is needs login

    public function main(){

        $user = (new user())->find(1);

        var_dump($user);

        $userList = Db::table('sys_users')->select(array(
            'sys_users.*',
            'sys_user_groups.group_name',
            'sys_user_groups.group_level'))
            ->left_join('sys_user_groups', array('user_groupID', '=', 'id'))
            ->get();

        ViewLoader::view('user.list')
            ->withList('userList', $userList, 'user.list_format')
            ->writeContent();

    }
}